<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>七牛云算法</title>
</head>
<body>
<script>
    var data=[
        {name:"n1",value:1},
        {name:"n2",value:2},
        {name:"n3",value:3},
        {name:"n4",value:4},
        {name:"n5",value:5}
    ];

    function findNameOfValue(x){
        for(var i=0;i<data.length;i++){
            if(data[i].value==x) {
                return data[i];
            }
        }
        if(i==data.length){
            return "Not FOUND";
        }
    }

    console.log(findNameOfValue(5));

</script>
</body>
</html>